<!DOCTYPE html>
<html>
	<head>
		<title>修改密码</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<!-- 所有的 css & js 资源 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
		<link rel="stylesheet" href="../../static/sa.css"> 
		<script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.min.js"></script>
		<script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
		<script src="../../static/sa.js"></script>
		<style>
			/* body,.sbot.vue-box{background-color: #EEE !important;} */
			.c-item .c-label{width: 10em;}
			.c-item .el-input__inner{width: 300px;}
        </style>
	</head>
	<body>
		<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
			<!-- ------- 内容部分 ------- -->
			<div class="s-body">
				<div class="c-panel">
					<div class="c-title">数据添加</div>
					<el-form v-if="m">
						<sa-item type="password" name="旧密码" v-model="m.oldPwd" br></sa-item>
						<sa-item type="password" name="再次输入旧密码" v-model="m.oldPwd2" br></sa-item>
						<sa-item type="password" name="新密码" v-model="m.newPwd" br></sa-item>
						<sa-item type="password" name="再次输入新密码" v-model="m.newPwd2" br></sa-item>
					</el-form>
				</div>
			</div>
			<!-- ------- 底部按钮 ------- -->
			<div class="s-foot">
				<el-button type="primary" @click="ok()">确定</el-button>
				<el-button @click="sa.closeCurrIframe()">取消</el-button>
			</div>

		</div>
		<script>
			var app = new Vue({
				components: {
					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
				},
				el: '.vue-box',
				data: {
					sa: sa,
					m: {
						oldPwd: '',
						oldPwd2: '',
						newPwd: '',
						newPwd2: ''
					},
				},
				methods: {
					// 提交 
					ok: function() {
						// 表单校验 
						let m = this.m;
						sa.checkNull(m.oldPwd && m.oldPwd2 && m.newPwd && m.newPwd2, '请填写'); 
						sa.check(m.oldPwd != m.oldPwd2, '旧密码两次输入不一致');
						sa.check(m.newPwd != m.newPwd2, '新密码两次输入不一致');
						sa.check(m.newPwd.length < 4, '新密码请不要低于六位数');
						// 开始修改 
						sa.ajax('/AdminPassword/update', this.m, function(res) {
							if(parent != window) {
								sa.closeCurrIframe();
								parent.sa.ok2('修改成功');
							}
						})
						//sa.$fast.fastUpdate2('/SysUser/updatePassword', this.m);
					},
				},
				mounted: function() {
					
				}
			})
		</script>
	</body>
</html>
